﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Traceability.Register.Infrastructrue.Migrations
{
    public partial class 用户 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Addresses",
                columns: table => new
                {
                    AddressId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Pid = table.Column<int>(type: "int", nullable: false),
                    AddressName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Level = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Addresses", x => x.AddressId);
                });

            migrationBuilder.CreateTable(
                name: "BreedingEnterprise",
                columns: table => new
                {
                    EntierpriseId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Farm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    Principal = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    BreedingStock = table.Column<int>(type: "int", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    BreedingId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BreedingEnterprise", x => x.EntierpriseId);
                });

            migrationBuilder.CreateTable(
                name: "Breedings",
                columns: table => new
                {
                    BreedingsId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Bread = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Source = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    FeedingDay = table.Column<int>(type: "int", nullable: false),
                    BreedingBrand = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    HeadFeeder = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    PublicationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false),
                    TraceabilityId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Breedings", x => x.BreedingsId);
                });

            migrationBuilder.CreateTable(
                name: "Goods",
                columns: table => new
                {
                    GoodId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GoodName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Goods", x => x.GoodId);
                });

            migrationBuilder.CreateTable(
                name: "Imunitys",
                columns: table => new
                {
                    ImunityId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RearingDays = table.Column<int>(type: "int", nullable: false),
                    ImunityWay = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ImunityMethods = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    BreedingId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Imunitys", x => x.ImunityId);
                });

            migrationBuilder.CreateTable(
                name: "MachiningEnterprise",
                columns: table => new
                {
                    MachiningEnterpriseId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TeamOrGroupName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Princepals = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    RawMaterialBatch = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    IngredIentsBatch = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    AdditiveBatch = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    PackingMaterialsBatch = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    EnterpriseName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    ProductionLicense = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MachiningEnterprise", x => x.MachiningEnterpriseId);
                });

            migrationBuilder.CreateTable(
                name: "Pictures",
                columns: table => new
                {
                    PictureId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ImgerPath = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ImgerType = table.Column<int>(type: "int", nullable: false),
                    TraceabilityId = table.Column<int>(type: "int", nullable: false),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Pictures", x => x.PictureId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterEnterprise",
                columns: table => new
                {
                    CompanyId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CompanyName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    EstablishDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    AddressId = table.Column<int>(type: "int", nullable: false),
                    CompanyProfile = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterEnterprise", x => x.CompanyId);
                });

            migrationBuilder.CreateTable(
                name: "Slaughters",
                columns: table => new
                {
                    SlaughterId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Batch = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    WeightToFactory = table.Column<int>(type: "int", nullable: false),
                    ArrivalTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    SlaughterTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    TraceabilityId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Slaughters", x => x.SlaughterId);
                });

            migrationBuilder.CreateTable(
                name: "Traceabilitys",
                columns: table => new
                {
                    TraceabilityId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GoodId = table.Column<int>(type: "int", nullable: false),
                    ProductionBatch = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    ExprirationDate = table.Column<int>(type: "int", nullable: false),
                    ProductionLicense = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    ProductionEnterprise = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    GoverImarger = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Traceabilitys", x => x.TraceabilityId);
                });

            migrationBuilder.CreateTable(
                name: "UserInfo",
                columns: table => new
                {
                    UserinfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserinfoName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Password = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Email = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(11)", maxLength: 11, nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    Role = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserInfo", x => x.UserinfoId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Addresses");

            migrationBuilder.DropTable(
                name: "BreedingEnterprise");

            migrationBuilder.DropTable(
                name: "Breedings");

            migrationBuilder.DropTable(
                name: "Goods");

            migrationBuilder.DropTable(
                name: "Imunitys");

            migrationBuilder.DropTable(
                name: "MachiningEnterprise");

            migrationBuilder.DropTable(
                name: "Pictures");

            migrationBuilder.DropTable(
                name: "SlaughterEnterprise");

            migrationBuilder.DropTable(
                name: "Slaughters");

            migrationBuilder.DropTable(
                name: "Traceabilitys");

            migrationBuilder.DropTable(
                name: "UserInfo");
        }
    }
}
